package com.qf.bbapi.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.bbapi.entity.TeaGoods;
import com.qf.bbapi.service.intf.TeaGoodsService;
import com.qf.bbapi.vo.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wodexinhuai
 * @create 2022-07-01-21:29
 */
@RestController
@RequestMapping("/api/teagoods")
@Api(tags = "商品")
@CrossOrigin
public class TeaGoodsController {
    @Resource
    private TeaGoodsService service;

    @GetMapping("/all.do")
    @ApiOperation("展示所有商品信息")
    public R all(){
        return service.all();
    }

    @GetMapping("selByTid.do")
    @ApiOperation("通过类型id查询商品")
    public R selByTid(int tid){
        return service.selByTid(tid);
    }

    @GetMapping("selToList.do")
    @ApiOperation("一对多 存到集合")
    public R selToList(){
        return service.selToList();
    }

    @GetMapping("selOne.do")
    @ApiOperation("商品详情")
    public R selOne(int id){
        return service.GoodIngo(id);
    }
}
